package com.jill.Mapper;

import com.jill.Pojo.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

@Mapper
public interface ArticleMapper{

    // 首页数据
    public List<Article> index();

    // 根据文章类型输出数据
    public List<Article> findByCate(Integer id);

    // 添加文章阅读量
    @Update("update articles set count=count+1 where id=#{id};")
    public void addCount(Integer id);

    @Select("select title,count from articles order by count desc limit 0,3;")
    public List<Article> hotArticle();
}
